const WebSocket = require("ws");
const wss = new WebSocket.Server({ port: 9998 });

module.exports.listen = () => {
  wss.on("connection", (client) => {
    console.log("客户端连接成功");
    client.on("message", (msg) => {
      console.log("客户端消息: ", JSON.parse(msg));
      client.send("hello websocket");
    });
  });
};
